<!--
 * @Author: 可以清心
 * @Description: 
 * @Date: 2023-05-19 15:21:50
 * @LastEditTime: 2023-05-21 17:59:47
-->
<template>
    <header class="header">
        <div class="logo">
            <img src="@/assets/logo.jpg" />
        </div>
        <div class="title">{{ title }}</div>
        <div class="date">{{ date }}</div>
    </header>
</template>

<script>
    import dayjs from 'dayjs'
    export default {
        name: "Header",
        data(){
            return {
                title: "天能集团-电子出门证系统",
                date: ""
            }
        },
        created(){
            const {setData} = this;
            setData();

            let timeId = setInterval(setData, 1000 * 60);

            this.$once("hook:beforeDestory", () => {
                if(timeId){
                    clearInterval(timeId);
                }
            })
        },
        methods: {
            setData(){
                this.date = dayjs().format('YYYY-M-D HH:mm')
            }
        }
    }
</script>

<style lang="less" scoped>
    @import "./index";
</style>